#include "dialog.h"
#include "ui_dialog.h"

Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);
//    move(QApplication::desktop()->availableGeometry().center() - this->rect().center());
    center();
}

QString Dialog::getUser()
{
    return ui->lneUsuario->text();
}

QString Dialog::getPassword()
{
    return ui->lnePassword->text();
}

void Dialog::setMessage(QString msg)
{
    ui->lblMensaje->setText(msg);
}

void Dialog::setFocusPassword()
{
    ui->lnePassword->setFocus();
}

void Dialog::center()
{
    const QRect screen = QApplication::desktop()->screenGeometry();
    this->move( screen.center() - this->rect().center() );
//    qDebug() << "screen :" << screen.center();
//    qDebug() << "dialog :" << this->rect().center();
}

Dialog::~Dialog()
{
    delete ui;
}
